<?php
/**
 * @link https://www.kancloud.cn/cleverstone/ymb2
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

use yii\helpers\Json;

/* ===================== 动态控件项JS值获取模板 ===================== */

/** @var \yii\web\View $this View实例 */
/** @var string $currentField 当前字段 */
/** @var array $controlOptions 表单控件选项 */
?>
<script>
    /** @var ueEditor UE实例  */
    /** @var currentGroupField 当前表单组字段  */
    /** @var result 结果容器  */
    /** @var dynamicUnSubmitFields 动态控件中不提交字段  */
    dynamicUnSubmitFields = <?= Json::encode($controlOptions['unSubmitFields']) ?>;
    result[currentGroupField]["<?= $currentField ?>"] = lodash.cloneDeep( $scope.<?= $controlOptions['__scope'] ?> );
    result[currentGroupField]["<?= $currentField ?>"].map(function (value) {
        dynamicUnSubmitFields.forEach(function (item) {
            delete value[item];
        });
        return value;
    });
</script>
